/**
 * 
 */
package com.thinkgsp.jxc.model;

import java.io.Serializable;

import org.apache.commons.lang.builder.ToStringBuilder;
import org.apache.commons.lang.builder.ToStringStyle;

/**
 * 存货地址(门店或库房)
 * @author evan
 *
 */
public class InventoryAdd extends BaseModel implements Serializable {

	/**
	 * 存货地址类型:库房 
	 */
	public static final int INVENTORY_ADD_STOCK = 0;
	
	/**
	 * 存货地址类型:门店
	 */
	public static final int INVENTORY_ADD_BRANCH = 1;
	
	private static final long serialVersionUID = 4681482529036009761L;

	private Integer id;
	private String inventoryAddName;
	private Integer inventoryType;
	private Integer deptId;
	private Dept dept;
	private boolean defaultInvAdd = false;
	/**
	 * 存货地址关联的部门
	 * @return
	 */
	public Dept getDept() {
		return dept;
	}

	public void setDept(Dept dept) {
		this.dept = dept;
		this.deptId = dept.getDeptId();
	}

	/**
	 * 用户当前默认的库房,本属性只在编辑用户的可用库房时使用
	 * @return the defaultInvAdd
	 */
	public boolean isDefaultInvAdd() {
		return defaultInvAdd;
	}

	/**
	 * @param defaultInvAdd the defaultInvAdd to set
	 */
	public void setDefaultInvAdd(boolean defaultInvAdd) {
		this.defaultInvAdd = defaultInvAdd;
	}

	/**
	 * 存货地址ID
	 * @return
	 */
	public Integer getId() {
		return id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	/**
	 * 门店或库房名称
	 * @return
	 */
	public String getInventoryAddName() {
		return inventoryAddName;
	}

	public void setInventoryAddName(String inventoryAddName) {
		this.inventoryAddName = inventoryAddName;
	}

	/**
	 * 类型 (0 : 库房 ; 1 : 门店)
	 * @return
	 */
	public Integer getInventoryType() {
		return inventoryType;
	}

	public void setInventoryType(Integer inventoryType) {
		this.inventoryType = inventoryType;
	}

	/**
	 * 负责部门
	 * @return
	 */
	public Integer getDeptId() {
		return deptId;
	}

	public void setDeptId(Integer deptId) {
		this.deptId = deptId;
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#toString()
	 */
	@Override
	public String toString() {
		ToStringBuilder sb = new ToStringBuilder(this, ToStringStyle.DEFAULT_STYLE);
		sb.append("id",this.id)
		  .append("inventoryAddName",this.inventoryAddName)
		  .append("inventoryType",this.inventoryType);
		
		return sb.toString();
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#equals(java.lang.Object)
	 */
	@Override
	public boolean equals(Object o) {
		if(this == o) {
			return true;
		}
		if(!(o instanceof InventoryAdd)) {
			return false;
		}
		final InventoryAdd invAdd = (InventoryAdd)o;
		if(id != null) {
			return id.equals(invAdd.getId());
		} else {
			return invAdd.getId() == null;
		}
	}

	/* (non-Javadoc)
	 * @see com.thinkgsp.jxc.model.BaseModel#hashCode()
	 */
	@Override
	public int hashCode() {
		return (this.id != null ? this.id.hashCode() : 0);
	}
}
